package com.flow;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.io.Text;

import java.io.IOException;


public class FlowMapper extends Mapper<LongWritable, Text, Text, FlowBean> {


    @Override
    protected void map(LongWritable key, Text text, Context context) throws IOException, InterruptedException {
        String [] fields = text.toString().split("\t");
        Text phone = new Text(fields[1]);
        long upFlow = Long.parseLong(fields[7]);
        long downFlow = Long.parseLong(fields[8]);
        context.write(phone,new FlowBean(upFlow,downFlow));
    }
}

